Introduced focusAsync for cheaper element focusing, and made FocusTrapZone utilize it#4306
Merged
dzearing merged 4 commits intomicrosoft:masterfrom Mar 22, 2018
Merged
Conversation
added 2 commits
March 19, 2018 15:59
Member
Author
|
@dzearing - There is a dependency on office-ui-fabric-react to the newest utilities build with this change. Should both be marked as minor versions, instead of patches, due to that? |
dzearing
reviewed
Mar 20, 2018
| expect(lastFocusedElement).toBe(buttonD); | ||
| // Pressing tab should go to a. | ||
| ReactTestUtils.Simulate.keyDown(buttonD, { which: KeyCodes.tab }); | ||
| window.requestAnimationFrame(() => { |
Member
There was a problem hiding this comment.
hope this works in ie11. might be worth checking.
Member
Author
There was a problem hiding this comment.
Yup, works like a charm on the testpage (and we have been using this successfully outside of fabric-react for some weeks)
dzearing
approved these changes
Mar 22, 2018
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull request checklist
$ npm run changeDescription of changes
We have experienced that using FocusTrapZone becomes expensive if you focus immediately after rendering your wrapped components (depending on content complexity of course), as the focus() it does triggers a recalculation in the browser. This change introduces a focusAsync helper function that the FocusTrapZone will use, which sets focus on the next browser repaint (using requestAnimationFrame). This causes the focus to be a lot cheaper, as it prevents unnecessary browser recalculations
Focus areas to test
(optional)